package com.treasure.mall.biz.service.core.wechat.impl;

import com.treasure.mall.biz.entity.wechat.WechatConfigPO;
import com.treasure.mall.biz.repository.wechat.WechatConfigRepository;
import com.treasure.mall.biz.service.core.wechat.WechatConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 
 * +---------------------------------------------------------
 * * @package: com.treasure.mall.biz.service.core.wechat.impl
 * * @author: guomw (guomwchen@foxmail.com)
 * * @date: 2020/6/24 13:07
 * * @since: V1.0.0
 * +---------------------------------------------------------
 * 注意：本内容仅限于内部传阅，禁止外泄以及用于其他的商业目的
 * Copyright 2019-2022 com.treasure.mall.biz.service.core.wechat.impl Inc. All rights reserved.
 */
@Service
public class WechatConfigServiceImpl implements WechatConfigService {

    @Autowired
    private WechatConfigRepository wechatConfigRepository;


    @Override
    public WechatConfigPO findById(String appId) {
        return wechatConfigRepository.findById(appId).orElse(null);
    }

    @Override
    public WechatConfigPO save(WechatConfigPO entity) {
        return wechatConfigRepository.save(entity);
    }

    /***
     * 判断是否存在数据
     * @return
     */
    @Override
    public Boolean exist() {
        return wechatConfigRepository.count() > 0;
    }
}
